package com.woniu.mall.controller;

import com.woniu.common.annotation.LoginUser;
import com.woniu.common.entity.Result;
import com.woniu.mall.service.CouponBusinessService;

import com.woniu.user.vo.UserLoginVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 1. @description:
 * 2. @author: Lingger
 * 3. @time: 2023/5/23
 */
@RequestMapping("/couponBusiness")
@RestController
@Api(tags = "优惠券商家端")
public class CouponBusinessController {

    @Autowired
    private CouponBusinessService couponBusinessService;

    @ApiOperation("生成商家优惠券")
    @GetMapping("/saveBusinessCoupon")
    public Result saveBusinessCoupon(@LoginUser UserLoginVO userLoginVO) {

        Boolean flag = couponBusinessService.saveBusinessCoupon(userLoginVO);
        return Result.ok(flag);
    }

    @ApiOperation("删除商家优惠券")
    @GetMapping("/removeBusinessCoupon")
    public Result removeBusinessCoupon(@LoginUser UserLoginVO userLoginVO) {

        Boolean flag = couponBusinessService.removeBusinessCoupon(userLoginVO);
        return Result.ok(flag);
    }
}
